package com.wdemo.tools;

import com.wdemo.contants.SpringAiContant;
import com.wdemo.pojo.PrePlaceOrder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * @ClassName OrderTools
 * @Description 订单工具
 * @Author WDEMO
 * @Date 2025/8/24 16:01
 */
@Slf4j
@Component
public class OrderTools {

    /**
     * 下单购买
     * @param serveId 服务id
     * @param serveStartTime 预约时间
     * @return
     */
    @Tool(description = SpringAiContant.Tools.PRE_PLACE_ORDER)
    public PrePlaceOrder prePlaceOrder(@ToolParam(description = SpringAiContant.ToolParams.SERVE_ID) Long serveId,
                                       @ToolParam(description = SpringAiContant.ToolParams.SERVE_START_TIME) LocalDateTime serveStartTime) {
      log.info("下单购买，服务id：{}，预约时间：{}", serveId, serveStartTime);
        // 1. 校验服务是否存在
        // 2. 校验服务是否可预约时间

        //远程调用优惠券接口，查询可用优惠券

        //远程调用地址普接接口，查询地址信息

//        String requestId = Convert.toStr(toolContext.getContext().get(Contants.REQUEST_ID));
//        log.info("请求Id:{}",requestId);
//        String field = StrUtil.lowerFirst(PrePlaceOrder.class.getSimpleName());
//        ToolResultHolder.put(requestId,field,new PrePlaceOrder());
        return null;
    }
}
